<?php if (!defined('THINK_PATH')) exit();?><head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width,initial-scale=1.0,minimum-scale=1.0, maximum-scale=1.0,user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge">
    <title>长乐美食城 - 账号登录</title>
    <link rel="stylesheet" type="text/css" href="/Public/assets/home/css/register.css"/>
    <link rel="stylesheet" href="/Public/assets/home/vendors/mobiscroll-master/css/mobiscroll.frame.css">
    <link rel="stylesheet" href="/Public/assets/home/vendors/mobiscroll-master/css/mobiscroll.scroller.css">
    <!--<link rel="stylesheet" href="/Public/vendor/assets/css/amazeui.min.css"/>-->
    <!--<link rel="stylesheet" href="/Public/vendor/datetimepickerpath/css/amazeui.datetimepicker.css"/>-->

</head>
<body class="zh_CN">
<div class="wrapper">
    <div class="wrap">
        <div class="layout">
            <div class="n-frame device-frame reg_frame" id="main_container">
                <div class="external_logo_area"><a class="milogo" href="javascript:void(0)"></a></div>
                <div class="title-item t_c">
                    <h4 class="title_big30">注册长乐美食城帐号</h4>
                </div>
                <form>
                    <div class="regbox">
                        <div class="phone_step1">
                            <h4 class="tit_normal">
                                用户昵称：
                            </h4>
                            <div class="listwraps select-regions">
                                <div class="inputbg">
                                    <label class="labelbox">
                                        <input type="text" id="nickname" name="nickname" data-type="PH"
                                               placeholder="请输入昵称">
                                    </label>
                                </div>
                            </div>

                            <h4 class="tit_normal">
                                上传头像：
                            </h4>
                            <div class="listwraps elect-regions">
                                <div class="inputbg">
                                    <label class="labelbox new_thumb">
                                        <input type="text"  name="thumb" placeholder="请点击上传头像">
                                    </label>
                                    <div class="am-form-group am-form-file">
                                        <div id="upload_one" style="display: none;"></div>
                                        <div id="view_one">
                                            <input type="hidden" id="thumb" name="thumb" value="">
                                            <img src="" class="img-responsive"
                                                 style="margin-top:5px;max-height:150px;max-width: 150px;">
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <h4 class="tit_normal">
                                手机号码：
                            </h4>
                            <div class="listwraps elect-regions">
                                <div class="inputbg">
                                    <label class="labelbox">
                                        <input type="text" id="mobile" name="mobile" placeholder="请输入手机号码">
                                    </label>
                                </div>
                            </div>
                            <h4 class="tit_normal">
                                性别：
                            </h4>
                            <div class="listwraps elect-regions">
                                <div class="inputbg">
                                    <label class="labelbox">
                                        <input type="text" id="sex" name="sex" placeholder="请输入性别: 1代表男；0代表女">
                                    </label>
                                </div>
                            </div>
                            <h4 class="tit_normal">
                                生日：
                            </h4>
                            <div class="listwraps elect-regions">
                                <div class="inputbg">
                                    <label class="labelbox">
                                        <input type="text" id="birthday" name="birthday" placeholder="请输入生日">
                                    </label>
                                </div>
                            </div>
                            <h4 class="tit_normal">
                                邮箱：
                            </h4>
                            <div class="listwraps elect-regions">
                                <div class="inputbg">
                                    <label class="labelbox">
                                        <input type="text" id="email" name="email" placeholder="请输入邮箱">
                                    </label>
                                </div>
                            </div>
                            <h4 class="tit_normal">
                                地址：
                            </h4>
                            <div class="listwraps elect-regions">
                                <div class="inputbg">

                                    <label class="labelbox">
                                        <input name="pca" id="pca" type="text" placeholder="请选择地区"/></div>
                            </div>
                            <h4 class="tit_normal">
                                密码：
                            </h4>
                            <div class="listwraps elect-regions">
                                <div class="inputbg">
                                    <label class="labelbox">
                                        <input type="password" id="password" name="password" placeholder="请输入密码">
                                    </label>
                                </div>
                            </div>
                            <h4 class="tit_normal">
                                确认密码：
                            </h4>
                            <div class="listwraps elect-regions">
                                <div class="inputbg">
                                    <label class="labelbox">
                                        <input type="password" id="check_password" name="check_password"
                                               placeholder="请再次输入密码">
                                    </label>
                                </div>
                            </div>

                            <div class="fixed_bot mar_phone_dis1">
                                <input class="btn332 btn_reg_1 submit" data-to="phone-step2" type="submit"
                                       value="立即注册">
                                <p class="msg">
                                    注册帐号即表示您同意并愿意遵守长乐美食城 <a href="http://www.miui.com/res/doc/eula/cn.html"
                                                            class="inspect_link agreement_link" title="用户协议"
                                                            target="_blank">用户协议</a>和<a
                                        href="http://www.miui.com/res/doc/privacy/cn.html"
                                        class="inspect_link privacy_link" title=" 隐私政策 " target="_blank"> 隐私政策 </a>
                                </p>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<div class="n-footer">
    <div class="nf-link-area clearfix">
        <ul class="lang-select-list">
            <li><a class="lang-select-li current" href="javascript:void(0)" data-lang="zh_CN">简体</a>|</li>
            <li><a class="lang-select-li" href="javascript:void(0)" data-lang="zh_TW">繁体</a>|</li>
            <li><a class="lang-select-li" href="javascript:void(0)" data-lang="en">English</a></li>
            |
            <li><a class="a_critical" href="https://static.account.xiaomi.com/html/faq/faqList.html"
                   target="_blank"><em></em>常见问题</a></li>
        </ul>
    </div>
    <p class="nf-intro">
        <span>武汉长乐未央网络科技有限公司版权所有<br>
            <img src="https://account.xiaomi.com/static/res/9204d06/account-static/respassport/acc-2014/img/ghs.png">
        </span>鄂公网安备1234567890011号-鄂ICP证666888号</span>
    </p>
</div>
<!--<script src="/Public/vendor/datetimepicker/js/amazeui.datetimepicker.min.js"></script>-->

<script type="text/javascript" src="/Public/assets/home/js/jquery.min.js"></script>
<script type="text/javascript"
        src="/Public/assets/home/vendors/mobiscroll-master/js/mobiscroll.core.js"></script>
<script type="text/javascript"
        src="/Public/assets/home/vendors/mobiscroll-master/js/mobiscroll.frame.js"></script>
<script type="text/javascript"
        src="/Public/assets/home/vendors/mobiscroll-master/js/mobiscroll.scroller.js"></script>
<script type="text/javascript"
        src="/Public/assets/home/vendors/mobiscroll-master/js/mobiscroll.select.js"></script>
<script type="text/javascript"
        src="/Public/assets/home/vendors/mobiscroll-master/js/i18n/mobiscroll.i18n.zh.js"></script>

<script type="text/javascript" src="/Public/assets/home/js/areas.js"></script>
<script src="/Public/vendor/bootstrapextend/js/bootstrap.extend.js"></script>


<script>
    $(function () {

        //显示新增地址
        $('#createAddress').click(function () {
            $(this).next().toggle();
        });

        //收起新增地址
        $('.cancel').click(function () {
            $(this).parents('.address-form').hide();
            return false;
        });

        //省市区插件
        $('#pca').mobiscroll().scroller({
            theme: 'mobiscroll',
            lang: 'zh',
            display: 'top',
            fixedWidth: [100, 100, 100],
            onBeforeShow: function (inst) {
                var areaList = new Areas();
                inst.settings.wheels = [[areaList.getData(1), areaList.getData(inst._tempWheelArray[0]), areaList.getData(inst._tempWheelArray[1])]];
            },

            parseValue: function (val) {
                return [110000, 110100, 110101];
            },

            validate: function (html, index, time, dir, inst) {
                var areaList = new Areas();

                if (index == 0) {
                    inst.settings.wheels[0][1] = areaList.getData(inst._tempWheelArray[0]);
                    inst.changeWheel([1]);

                    inst.settings.wheels[0][2] = areaList.getData(inst._tempWheelArray[1]);
                    inst.changeWheel([2]);
                }

                if (index == 1) {
                    inst.settings.wheels[0][2] = areaList.getData(inst._tempWheelArray[1]);
                    inst.changeWheel([2]);
                }
            },

            formatValue: function (data) {
                var areaList = new Areas();
                return areaList.getNameById(data[0]) + ' ' + areaList.getNameById(data[1]) + ' ' + areaList.getNameById(data[2]);
            }
        });

        //给上传图片按钮绑定事件
        $('.new_thumb').click(function () {
            $("#file_upload_1-button").click();
        })


        //上传单张
        $('#upload_one').Huploadify({
            uploader: '<?php echo U("Admin/Uploadfile/upload");?>',
            fileTypeExts: '*.gif;*.jpg;*.jpeg;*.png;*.bmp',
            //fileSizeLimit:{:C('UPLOAD_IMAGE_SIZE')}*1024,
            buttonText: '上 传 图 片',
            onUploadComplete: function (file, data) {
                data = $.parseJSON(data);
                $('#view_one img').attr('src', data.real_path);
                $('#view_one input').attr('value', data.real_path);

            }
        });

        $('.submit').click(function () {
            var info = {
                nickname: $('#nickname').val(),
                thumb: $('#thumb').val(),
                sex: $('#sex').val(),
                mobile: $('#mobile').val(),
                email: $('#email').val(),
                birthday: $('#birthday').val(),
                pca: $('#pca').val(),
                password: $('#password').val(),
                check_password: $('#check_password').val()

            };
            //js验证
            if (info.nickname.length < 5) {
                alert('用户名长度不能小于5位');
                return false;
            }
            if (info.sex.length == 0) {
                alert('请填写性别');
                return false;
            }
            var regex = /^(0|86|17951)?(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$/;
            if (!regex.test(info.mobile)) {
                alert('输入的手机格式不正确');
                return false;
            }
            var reg = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/;
            if (!reg.test(info.email)) {
                alert('输入的邮箱格式不正确');
                return false;
            }
            if (info.password.length < 6) {
                alert('输入的密码长度不能小于6位');
                return false;
            }
            if (info.check_password != info.password) {
                alert('两次密码输入不一致')
                return false;
            }

            //发送ajax请求
            $.post("<?php echo U('register');?>", info, function (face) {
                if (face.status == 1) {
                    alert(face.msg)
                    location.href = "<?php echo U('Customer/login');?>"
                } else {
                    alert(face.msg)
                    return false;
                }

            })
            return false;

        })
    })
</script>
</body>